package com.tuling.mall.user.controller;

import com.tuling.mall.common.R;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

@RequestMapping("/user")
@RestController
public class UserController {


    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/findOrder/{userId}")
    public R findOrder(@PathVariable("userId") String userId) {

        System.out.println("进入mall-user,处理user的逻辑");

        String url = "http://localhost:8010/order/findOrderByUserId/" + userId;

        restTemplate.getForEntity(url, R.class);



        return R.success();
    }

}
